<template>
  <div>
    <el-row>
      <el-col :span="8">
        <div id="ehart2_1" class="ehart2" :span="8">
        </div>
      </el-col>
      <el-col :span="8">
        <div id="ehart2_2" class="ehart2" :span="8">
        </div>
      </el-col>
      <el-col :span="8">
        <div id="ehart2_3" class="ehart2" :span="8">
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import * as echarts from 'echarts'

export default {
  data() {
    return {}
  },
  created() {
  },
  mounted() {
    this.initChart1()
    this.initChart2()
    this.initChart3()
  },
  methods: {
    initChart1() {
      var chartDom = document.getElementById('ehart2_1')
      var myChart = echarts.init(chartDom)
      var option

      option = {
        title: {
          text: 'Referer of a Website',
          subtext: 'Fake Data',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: [
              {value: 1048, name: 'Search Engine'},
              {value: 735, name: 'Direct'},
              {value: 580, name: 'Email'},
              {value: 484, name: 'Union Ads'},
              {value: 300, name: 'Video Ads'}
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }

      option && myChart.setOption(option)
    },
    initChart2() {
      var chartDom = document.getElementById('ehart2_2')
      var myChart = echarts.init(chartDom)
      var option

      option = {
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar'
          }
        ]
      }

      option && myChart.setOption(option)
    },
    initChart3() {
      var chartDom = document.getElementById('ehart2_3')
      var myChart = echarts.init(chartDom)
      var option

      option = {
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [150, 230, 224, 218, 135, 147, 260],
            type: 'line'
          }
        ]
      }

      option && myChart.setOption(option)
    }
  }
}
</script>

<style scoped>
.ehart2 {
  width: 600px;
  height: 600px;
}

</style>
